home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
telecomm
/
storm100.lzh
/
DIALSORT.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-11-04
|
3KB
|
107 lines
'Sorts dial directory alphabetically
'Assumes 10 blank entries is end of directory
'Zaps entries with no name or number
mx = SET("STORM","Dialer","Entries")
IF mx = 0 THEN mx = 60:'use default
DIM dnam$(mx),dnum$(mx),dlog$(mx),dtrm$(mx),dcom$(mx),flag(mx)
PRINT "Retrieving dial directory from memory..."
PRINT ""
LastFound = 0
FAST ON :
j = 1
null = 0
FOR i = 1 TO mx
mynum$ = STR$(i)
dnam$(j) = SET$("DIALDIR",mynum$,"Name")
dnum$(j) = SET$("DIALDIR",mynum$,"#")
dlog$(j) = SET$("DIALDIR",mynum$,"Logon")
dtrm$(j) = SET$("DIALDIR",mynum$,"Term")
dcom$(j) = SET$("DIALDIR",mynum$,"COM")
'If no name and number, trash entry
x$ = dnam$(j) + dnum$(j)
IF LEN(x$) = 0 THEN
SET "DIALDIR",mynum$,"Logon",""
SET "DIALDIR",mynum$,"Term",""
SET "DIALDIR",mynum$,"COM",""
dlog$(j) = ""
dtrm$(j) = ""
dcom$(j) = ""
flag(i) = 1
ENDIF
x$ = x$ + dlog$(j) + dtrm$(j) + dcom$(j)
IF LEN(x$) > 0 THEN
PRINT " ";dnam$(j)
total = j
LastFound = i
flag(i) = 1
j = j + 1
null = 0
ELSE
null = null + 1
IF null = 10 THEN
POP
GOTO ok1
ENDIF
ENDIF
NEXT i
ok1:
PRINT
high = i
x$ = " entries."
IF total = 1 THEN x$ = " entry."
PRINT "Found ";total;x$
IF total < 2 THEN END
PRINT "Beginning sort phase..."
sort1:
changed = 0
FOR i = 1 TO total - 1
IF dnam$(i + 1) < dnam$(i) THEN
tnam$ = dnam$(i)
tnum$ = dnum$(i)
tlog$ = dlog$(i)
ttrm$ = dtrm$(i)
tcom$ = dcom$(i)
dnam$(i) = dnam$(i + 1)
dnum$(i) = dnum$(i + 1)
dlog$(i) = dlog$(i + 1)
dtrm$(i) = dtrm$(i + 1)
dcom$(i) = dcom$(i + 1)
dnam$(i + 1) = tnam$
dnum$(i + 1) = tnum$
dlog$(i + 1) = tlog$
dtrm$(i + 1) = ttrm$
dcom$(i + 1) = tcom$
changed = 1
ENDIF
NEXT i
IF changed > 0 THEN GOTO sort1
sorted:
PRINT "Sort phase complete."
PRINT "Storing updated directory..."
PRINT
FOR i = 1 TO total
PRINT " ";dnam$(i)
mynum$ = STR$(i)
SET "DIALDIR",mynum$,"Name",dnam$(i)
SET "DIALDIR",mynum$,"#",dnum$(i)
SET "DIALDIR",mynum$,"Logon",dlog$(i)
SET "DIALDIR",mynum$,"Term",dtrm$(i)
SET "DIALDIR",mynum$,"COM",dcom$(i)
NEXT i
'Clear entries past end of sorted list
FOR i = total + 1 TO LastFound
IF flag(i) THEN
mynum$ = STR$(i)
SET "DIALDIR",mynum$,"Name",""
SET "DIALDIR",mynum$,"#",""
SET "DIALDIR",mynum$,"Logon",""
SET "DIALDIR",mynum$,"Term",""
SET "DIALDIR",mynum$,"COM",""
ENDIF
NEXT i
PRINT ""
PRINT "Process complete."
PRINT "Verify and save new dial directory."
END